var defaultParams; //默认选中行
var menuId; //菜单栏父元素ID
var tableData; //定义列表名称
var sumFile = 0; //附件总数
// 详情
function detail(type) {
    if (defaultParams) {
        modifyVsdetailData("detail", true, type)
        $("#submitButton").hide()
        $("#saveButton").hide()
        $("#file").hide()
        $(".upload").hide()
        $(".chooseFileButton").hide()
    } else {
        layer.msg('请选择一项查看');
    }


}
// 删除
function deleteTr() {
    $table = $('#table')
    if (defaultParams && defaultParams["eventId"]) {
        var ids = [defaultParams["eventId"]]
    } else {
        var ids = []
    }

    if (ids.length != 0) {
        layer.confirm('确定删除选中？', {
            title: "温馨提示",
            btn: ['确定', '取消'] //按钮
        }, function() {
            $.ajax({
                type: "post",
                url: "/operation/event/new/delete",
                contentType: 'application/json',
                data: JSON.stringify({ "ids": ids }),
                dataType: "json",
                cache: false,
                success: function(data) {

                    layer.msg('成功', { time: 1000, icon: 1 });
                    defaultParams = ""
                    $("#table").bootstrapTable('refresh');

                },
                error: function(e) {
                    // 
                    if (e.status == 500) {
                        layer.msg("系统错误");
                        return
                    } else if (e.responseText) {
                        var errorMessage = JSON.parse(e.responseText).errors[0].message;
                        layer.msg(errorMessage);
                    }
                }
            })
        }, function() {
            layer.msg('删除操作取消', {
                time: 2000 //2s后自动关闭
            });
        });
    } else {
        layer.msg('请选择删除项');
    }

}
// 关单
function closeOrder() {
    if (defaultParams) {
        layer.confirm('确定关单', {
            title: "温馨提示",
            btn: ['确定', '取消'] //按钮
        }, function() {
            // 
            $.ajax({
                type: "post",
                url: "/operation/event/new/end",
                contentType: 'application/json',
                data: JSON.stringify({ "eventId": defaultParams.eventId }),
                dataType: "json",
                cache: false,
                success: function(data) {

                    layer.msg('成功', { time: 1000, icon: 1 });
                    defaultParams = ""
                    $("#table").bootstrapTable('refresh');

                },
                error: function(e) {
                    // 
                    if (e.status == 500) {
                        layer.msg("系统错误");
                        return
                    } else if (e.responseText) {
                        var errorMessage = JSON.parse(e.responseText).errors[0].message;
                        layer.msg(errorMessage);
                    }
                }
            })
        }, function() {
            layer.msg('关单操作取消', {
                time: 2000 //2s后自动关闭
            });
        });



    } else {
        layer.msg('请选择关单项');
    }
}
//返回
function back() {
    $("#buttonDetail").show()
    $("#buttonAdd").show()
    $("#buttonModify").show()
    $("#buttonDelete").show()
    $("#buttonClose").show()
    $("#buttonBack").hide()
    $(".buttonSearchBox").show()
    $(".bootstrap-table").show()
    $(".contentInput").hide()
    clearInput()
    defaultParams = "" //每次返回 清空上次选择
    $("#table").bootstrapTable('refresh');

}
//修改
function modify(type) {

    if (defaultParams) {
        if (defaultParams.status == "已提交") {
            layer.msg('提交后的信息无法修改');
        } else {
            modifyVsdetailData("modify", false, type)
            $("#file").show()
            $(".upload").show()
            $(".chooseFileButton").show()
            $("#submitButton").show()
            $("#submitButton").attr("disabled", false) //提交按钮可点击
            $("#saveButton").show()
            $("#subbmitMan").attr("disabled", true)
            $("#phone").attr("disabled", true)
            $("#organiza").attr("disabled", true)
        }

    } else {
        layer.msg('请选择一项修改');
    }
    // 
}
// 修改和详情数据

function modifyVsdetailData(isDetail, idDisabled, type) {
    $("#eventTitle").removeClass("defaultColor")
    $("#eventDesc").removeClass("defaultColor")
    $("#buttonDetail").hide()
    $("#buttonAdd").hide()
    $("#buttonModify").hide()
    $("#buttonDelete").hide()
    $("#buttonClose").hide()
    $("#buttonBack").show()
    $(".buttonSearchBox").hide()
    $(".bootstrap-table").hide()
    $(".contentInput").eq(0).show()
    $(".Isdisabled input").attr("disabled", idDisabled)
    $(".Isdisabled select").attr("disabled", idDisabled)
    $(".Isdisabled textarea").attr("disabled", idDisabled)
    if (type == "projectSystemProblemNew") {
        $("#problemType").attr("disabled", true)
    }
    $.ajax({
            url: "/operation/event/new/info/?id=" + defaultParams["eventId"],
            type: "get",
            dataType: "json",
            cache: false,
            success: function(data) {

                $("#subbmitMan").val(data.data["insertUserName"])
                $("#eventTitle").val(data.data["eventTheme"])
                $("#eventDesc").val(data.data["eventDetail"])
                $("#phone").val(data.data["tel"])
                    // 如果有回退原因，回退框显示
                if (data.data["backReason"] && data.data["backReason"] != "null") {
                    $(".returnBack").show()
                    $("#returnBackReason").val(data.data["backReason"])
                    $("#returnBackReason").attr("disabled", true)
                } else {
                    $(".returnBack").hide()
                }
                $("#organiza").val(data.data["orgName"])
                systemVsproblemData(type)
            },
            error: function(e) {

                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        })
        // 获取下载附件 附件1
    $.ajax({
            type: "get",
            url: "/operation/event/flow/file/submitProcess",
            dataType: "json",
            data: { "eventId": defaultParams.eventId },
            cache: false,
            success: function(data) {
                var str = ""
                sumFile = data.data.length
                if (isDetail == "detail") {
                    for (var i = 0; i < data.data.length; i++) {
                        var dealFileName = data.data[i].fileName;
                        str += '  <a  fileId="' + data.data[i].eventFlowFileId + '"  data-toggle="tooltip" data-placement="top" title="' + dealFileName + '" class="attachFile col-md-3 col-sm-3 col-xs-3 ieDeal  btn btn-success"   href="/operation/event/flow/file/download?fileId=' + data.data[i].eventFlowFileId + '">' + dealFileName + '</a>'
                    }
                } else {
                    for (var i = 0; i < data.data.length; i++) {
                        var dealFileName = data.data[i].fileName;
                        str += ' <a   fileId="' + data.data[i].eventFlowFileId + '"  data-toggle="tooltip" data-placement="top" title="' + dealFileName + '" class="ieDeal attachFile col-md-3 col-sm-3 col-xs-3  btn btn-success"   href="/operation/event/flow/file/download?fileId=' + data.data[i].eventFlowFileId + '">' + dealFileName + '<span class="deleteAttach glyphicon glyphicon-remove"></span></a>'

                    }
                }
                $(".attachFileBox").html(str)
                $("[data-toggle='tooltip']").tooltip()
            },
            error: function(e) {
                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        })
        // 获取回退附件信息
    $.ajax({
            type: "get",
            url: "/operation/event/flow/file/curentProcess",
            dataType: "json",
            data: { "eventId": defaultParams.eventId },
            cache: false,
            success: function(data) {
                var str = ""
                for (var i = 0; i < data.data.length; i++) {
                    var dealFileName = data.data[i].fileName
                    str += ' <a fileId="' + data.data[i].eventFlowFileId + '"  data-toggle="tooltip" data-placement="top" title="' + dealFileName + '" class="attachFile col-md-3 col-sm-3 col-xs-3  btn btn-success"  href="/operation/event/flow/file/download?fileId=' + data.data[i].eventFlowFileId + '">' + dealFileName + '</a>'

                }

                $(".attachFileBoxReturn").html(str)
                $("[data-toggle='tooltip']").tooltip()
            },
            error: function(e) {
                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        })
        // 
        // 操作纪录表单数据
        // 操作记录
        // 如果已提交无法查看操作纪录
    if (defaultParams["statusValue"]=="已提交") {
        $("#table2").show()
        $("#operationFlowTitle").show()
        $("#table2").bootstrapTable('destroy');
        // 
        $('#table2').bootstrapTable({
            striped: true, //隔行变色
            showHeader: true,
            cache: false,
            escape: true,
            ajax: function(request) {
                $.ajax({
                    type: "get",
                    url: "/operation/event/flow/",
                    dataType: "json",
                    data: { "eventId": defaultParams.eventId },
                    cache: false,
                    success: function(msg) {
                        for (var i = 0; i < msg.data.length; i++) {
                            msg.data[i]["updateTime"] = moment(msg.data[i]["updateTime"]).format('YYYY-MM-DD HH:mm:ss')

                            if (msg.data[i]["status"] == "11") {
                                msg.data[i]["status"] = "已保存"
                            } else if (msg.data[i]["status"] == "12") {
                                msg.data[i]["status"] = "已提交"
                            } else if (msg.data[i]["status"] == "13") {
                                msg.data[i]["status"] = "已回退"
                            } else if (msg.data[i]["status"] == "21") {
                                msg.data[i]["status"] = "待处理"
                            } else if (msg.data[i]["status"] == "22") {
                                msg.data[i]["status"] = "已分发"
                            } else if (msg.data[i]["status"] == "23") {
                                msg.data[i]["status"] = "待确认"
                            } else if (msg.data[i]["status"] == "30") {
                                msg.data[i]["status"] = "已处理"
                            } else if (msg.data[i]["status"] == "90") {
                                msg.data[i]["status"] = "已解决"
                            } else if (msg.data[i]["status"] == "91") {
                                msg.data[i]["status"] = "未解决"
                            }
                        }
                        request.success({
                            row: msg.data
                        });
                        $('#table2').bootstrapTable('load', msg.data);
                    },
                    error: function(e) {
                        if (e.status == 500) {
                            layer.msg("系统错误");
                            return
                        } else if (e.responseText) {
                            var errorMessage = JSON.parse(e.responseText).errors[0].message;
                            layer.msg(errorMessage);
                        }
                    }
                });
            },
            columns: columns = [
                { field: 'eventFlowId', title: 'id', align: "center", width: "20%" },
                { field: 'updateTime', title: '提交时间', align: "center" },
                { field: 'updateUserName', title: '提交人', align: "center" },
                { field: 'status', title: '当前状态', align: "center" },
                { field: 'processAdvice', title: '处理意见', align: "center" }
            ]

        });
        // 
    }else{
         $("#table2").hide()
    $("#operationFlowTitle").hide()
    }






    // 
}


//系统通道与问题类别数据

function systemVsproblemData(type) {
    // 系统通道数据
    if (type == "projectSystemProblemNew") {
        var params = { "menuId": menuId, "isOperation": true }
    } else {
        var params = { "menuId": menuId }
    }
    $.ajax({
        type: "get",
        url: "/operation/channel/getChannelByMenu",
        dataType: "json",
        contentType: 'application/json',
        data: params,
        cache: false,
        success: function(msg) {
            systermRouteData("#systermRoute", msg.data)
            $.ajax({
                type: "get",
                url: "/operation/question/getQuestionByMenuAndChannel",
                dataType: "json",
                contentType: 'application/json',
                data: { "menuId": menuId, "channelId": $("#systermRoute option:selected").attr("channelId") },
                cache: false,
                success: function(msg) {
                    problemTypeData("#problemType", msg.data, type)

                },
                error: function(e) {

                    if (e.status == 500) {
                        layer.msg("系统错误");
                        return
                    } else if (e.responseText) {
                        var errorMessage = JSON.parse(e.responseText).errors[0].message;
                        layer.msg(errorMessage);
                    }
                }
            });
        },
        error: function(e) {

            if (e.status == 500) {
                layer.msg("系统错误");
                return
            } else if (e.responseText) {
                var errorMessage = JSON.parse(e.responseText).errors[0].message;
                layer.msg(errorMessage);
            }
        }
    });
}
//增加
function add(type) {
    // 事件主题 样式
    $("#eventTitle").addClass("defaultColor")
    $("#eventDesc").addClass("defaultColor")
        // 事件描述 样式
        //清空input数据s
    $("#submitButton").attr("disabled", false) //提交按钮可点击
    $("#eventTitle").val("")
    $("#eventDesc").val("")
    $("#returnBackReason").val("")
    $(".attachFileBoxReturn").html("")
    clearInput()
    $("#subbmitMan").val(localStorage.getItem("userName"))
    $("#organiza").val(localStorage.getItem("orgName"))
    $("#phone").val(localStorage.getItem("tel"))
    $(".attachFileBox").html("")
    $("#eventTitle").val("关于***客户的问题")
    $("#eventDesc").val("申请编号：\n客户姓名：\n问题描述：在*****操作时出现****问题")
    sumFile = 0
        //清空input数据e
    defaultParams = ""
    $("#buttonDetail").hide()
    $("#buttonAdd").hide()
    $("#buttonModify").hide()
    $("#buttonDelete").hide()
    $("#buttonClose").hide()
    $("#buttonBack").show()
    systemVsproblemData(type)
        // 隐藏回退框
    $(".returnBack").hide()

    $(".buttonSearchBox").hide()
    $(".bootstrap-table").hide()
    $(".contentInput").eq(0).show()
    $(".contentInput input").attr("disabled", false)
    $(".contentInput select").attr("disabled", false)
    $(".contentInput textarea").attr("disabled", false)
    if (type == "projectSystemProblemNew") {
        $("#problemType").attr("disabled", true)
    }
    $("#file").show()
    $(".upload").show()
    $(".chooseFileButton").show()
    $("#submitButton").show()
    $("#saveButton").show()
    $("#subbmitMan").attr("disabled", true)
    $("#phone").attr("disabled", true)
    $("#organiza").attr("disabled", true)
     // 隐藏操作纪录 1219
     $("#operationFlowTitle").hide()
}

//获取问题类别数据
function getQuestionByMenuAndChannel() {
    if ($("#systermRoute option:selected").attr("channelId")) {
        $.ajax({
            type: "get",
            url: "/operation/question/getQuestionByMenuAndChannel",
            dataType: "json",
            contentType: 'application/json',
            data: { "menuId": menuId, "channelId": $("#systermRoute option:selected").attr("channelId") },
            cache: false,
            success: function(msg) {
                problemTypeData("#problemType", msg.data)

            },
            error: function() {
                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        });
    } else {
        $("#problemType").html('<option value=""></option>')
    }


    return
}
//删除搜索关键字
function removeSearchVal() {
    $("#searchVal").val("")
    $("#searchVal").focus()
}

//enter搜索
function noNumbers(e) {
    var keynum;
    var keychar;

    keynum = window.event ? e.keyCode : e.which;
    if (keynum == "13") {
        search()
    }
}
//清空默认 
function delDefault(e) {
    if (e.value == "可支持事件编号、事件主题、提交时间、处理人、状态搜索") {
        e.value = ""
    }
}
//移除焦点默认添加
function showTips(e) {
    if (e.value.replace(/^\s*|\s*$/g, "")) {} else {
        e.value = "可支持事件编号、事件主题、提交时间、处理人、状态搜索"
    }
}


function search() {
    var isOperation = location.href.split("?")[0].indexOf("projectSystemProblemNew") > -1 ? true : false;
    var searchval = $("#searchVal").val().indexOf("可支持事件编号、事件主题、提交时间、处理人、状态搜索") > -1 ? "" : $("#searchVal").val();
    $("#exportList").attr("href", encodeURI("/operation/event/new/export?menuId=" + menuId + "&" + "search=" + searchval + "&" + "isOperation=" + isOperation))

    defaultParams = ""
    $("#table").bootstrapTable('destroy');
    tableData.initData()
}


// 当二级类别为：“修改误操作取消/拒绝”    增加提示：2天内可处理，超过请重新进件
function problenTypeChange(targetName) {

    if (targetName.value === "修改误操作取消/拒绝") {
        $("#eventDesc").val("2天内可处理，超过请重新进件")
        $("#eventDesc").addClass("eventTitleClass")
    } else {
        if ($("#eventDesc").val() === "2天内可处理，超过请重新进件") {
            $("#eventDesc").val("申请编号：\n客户姓名：\n问题描述：在*****操作时出现****问题")
        }

        $("#eventDesc").removeClass("eventTitleClass")
    }

    //提示信息
    if ($("#problemType option:selected").attr("warninginfo") && $("#problemType option:selected").attr("warninginfo") != "null") {
        selectTips($("#problemType option:selected").attr("warninginfo"))
    }
}

function removeClass(target) {
    $(target).removeClass("defaultColor")
}

function eventDescFous(targetName) {
    $(targetName).removeClass("defaultColor")
    if (targetName.value === "2天内可处理，超过请重新进件") {
        targetName.value = ""
        $("#eventDesc").removeClass("eventTitleClass")
    }
}
//问题类别数据 
function problemTypeData(id, arr, type) {
    // 根据系统通道约束
    var str = ""
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]["questionName"] == defaultParams.questionName) {
            str += '  <option warninginfo="' + arr[i]["warningInfo"] + '" channelid="' + arr[i]["channelId"] + '" menuid="' + arr[i]["menuId"] + '" questionid="' + arr[i]["questionId"] + '"  selected value="' + arr[i]["questionName"] + '">' + arr[i]["questionName"] + '</option>'
        } else {
            str += '  <option warninginfo="' + arr[i]["warningInfo"] + '" channelid="' + arr[i]["channelId"] + '" menuid="' + arr[i]["menuId"] + '" questionid="' + arr[i]["questionId"] + '"  value="' + arr[i]["questionName"] + '">' + arr[i]["questionName"] + '</option>'
        }
    }
    $(id).html(str)
        //提示信息
    if (type !== "detail" && type !== "projectSystemProblemNew") {
        if ($("#problemType option:selected").attr("warninginfo") && $("#problemType option:selected").attr("warninginfo") != "null") {
            selectTips($("#problemType option:selected").attr("warninginfo"))
        }
    }



}

// 系统通道数据
function systermRouteData(id, arr) {
    var str = ''
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].channelName === defaultParams.channelName) {
            str += '  <option selected channelId="' + arr[i]['channelId'] + '">' + arr[i]['channelName'] + '</option>'
        } else {
            str += '  <option channelId="' + arr[i]['channelId'] + '">' + arr[i]['channelName'] + '</option>'
        }
    }
    $(id).html(str)
}
//提交
function submitButtonEvent() {
    if ($("#eventTitle").val().replace(/^\s*|\s*$/g, "") == "关于***客户的问题") {
        layer.msg("未修改事件主题及描述，不能提交申请");
    } else if ($("#eventDesc").val().replace(/^\s*|\s*$/g, "") == "申请编号：\n客户姓名：\n问题描述：在*****操作时出现****问题") {
        layer.msg("未修改事件主题及描述，不能提交申请");
    } else {
        var filesId = []
        if ($(".attachFileBox .attachFile")) {
            for (var i = 0; i < $(".attachFileBox .attachFile").length; i++) {
                filesId.push($(".attachFileBox .attachFile").eq(i).attr("fileid"))
            }
        }
        if (defaultParams) {
            var params = {
                "fileIds": filesId,
                "eventId": defaultParams.eventId,
                "menuId": $("#problemType option:selected").attr("menuid"),
                "channelId": $("#problemType option:selected").attr("channelid"),
                "questionId": $("#problemType option:selected").attr("questionid"),
                "eventTheme": $("#eventTitle").val(),
                "eventDetail": $("#eventDesc").val()
            }
        } else {

            var params = {
                "fileIds": filesId,
                "menuId": $("#problemType option:selected").attr("menuid"),
                "channelId": $("#problemType option:selected").attr("channelid"),
                "questionId": $("#problemType option:selected").attr("questionid"),
                "eventTheme": $("#eventTitle").val(),
                "eventDetail": $("#eventDesc").val()
            }
        }
        $.ajax({
            type: "post",
            url: "/operation/event/new/submit",
            contentType: 'application/json',
            data: JSON.stringify(params),
            dataType: "json",
            cache: false,
            success: function(data) {
                $("#submitButton").attr("disabled", true)
                $(".chooseFileButton").text("选择附件")
                layer.msg('成功', { time: 1000, icon: 1 });
                $("#searchVal").val("可支持事件编号、事件主题、提交时间、处理人、状态搜索")
                $("#table").bootstrapTable('refresh');
                $("#buttonBack").click()
            },
            error: function(e) {
                // 
                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        })

    }



    return false
}
//保存
function saveButtonEvent() {
    if ($("#eventTitle").val().replace(/^\s*|\s*$/g, "") == "关于***客户的问题") {
        layer.msg("未修改事件主题及描述，不能提交申请");
    } else if ($("#eventDesc").val().replace(/^\s*|\s*$/g, "") == "申请编号：\n客户姓名：\n问题描述：在*****操作时出现****问题") {
        layer.msg("未修改事件主题及描述，不能提交申请");
    } else {
        $("#saveButton").attr("disabled", true)
        var filesId = []
        if ($(".attachFileBox .attachFile")) {
            for (var i = 0; i < $(".attachFileBox .attachFile").length; i++) {
                filesId.push($(".attachFileBox .attachFile").eq(i).attr("fileid"))
            }
        }
        var params;
        if (defaultParams) {
            params = { //修改
                "eventId": defaultParams.eventId,
                "fileIds": filesId,
                "menuId": $("#problemType option:selected").attr("menuid"),
                "channelId": $("#problemType option:selected").attr("channelid"),
                "questionId": $("#problemType option:selected").attr("questionid"),
                "eventTheme": $("#eventTitle").val(),
                "eventDetail": $("#eventDesc").val()
            }
        } else { //新增
            params = {
                "fileIds": filesId,
                "menuId": $("#problemType option:selected").attr("menuid"),
                "channelId": $("#problemType option:selected").attr("channelid"),
                "questionId": $("#problemType option:selected").attr("questionid"),
                "eventTheme": $("#eventTitle").val(),
                "eventDetail": $("#eventDesc").val()
            }
        }
        $.ajax({
            type: "post",
            url: "/operation/event/new/save",
            contentType: 'application/json',
            data: JSON.stringify(params),
            dataType: "json",
            cache: false,
            success: function(data) {
                $(".chooseFileButton").text("选择附件")
                layer.msg('成功', { time: 1000, icon: 1 });
                $("#searchVal").val("可支持事件编号、事件主题、提交时间、处理人、状态搜索")
                $("#buttonBack").click()
                $("#table").bootstrapTable('refresh');
                $("#saveButton").attr("disabled", false)
            },
            error: function(e) {
                $("#saveButton").attr("disabled", false)
                if (e.status == 500) {
                    layer.msg("系统错误");
                    return
                } else if (e.responseText) {
                    var errorMessage = JSON.parse(e.responseText).errors[0].message;
                    layer.msg(errorMessage);
                }
            }
        })

    }

    return false;
}


//删除或下载附件 
$(".attachFileBox").on("click", $(".glyphicon-remove"), function(e) {
        var eve = e || window.event;
        var objEle = eve.target || eve.srcElement;
        if (objEle.className == "deleteAttach glyphicon glyphicon-remove") {
            sumFile--;
            $(objEle).parent().next().remove()
            $(objEle).parent().remove()
            return false
        }
    })
    //change附件
function changeRes(target) {
    var buttonName = target.value.replace(/^.+?\\([^\\]+?)(\.[^\.\\]*?)?$/gi, "$1") + '.' + target.value.replace(/.+\./, "")
    $(".chooseFileButton").text(buttonName)
}
//上传
function upload() {
    if ($("#file").val()) {
        var target = document.getElementById("file")
        $("#formId").submit();
    } else {
        layer.msg('请选择上传文件');
    }
}
$("#target").load(function() {

    var data = JSON.parse($($(this)[0].contentDocument.body).text())
    if (data.message == "文件不得大于5M") {
        layer.msg(data.message);
    } else {
        sumFile++
        if (sumFile > 10) {
            sumFile = 10
            layer.msg('最多可上传10个文件,请重新选择');
        } else { //可以上传
            fileId = data.data.fileId
            var str = ""
            var dealFileName = data.data.fileName;
            str += ' <a fileId="' + data.data.fileId + '"  data-toggle="tooltip" data-placement="top" title="' + dealFileName + '" class="attachFile ieDeal col-md-3 col-sm-3 col-xs-3  btn btn-success"  href="/operation/event/flow/file/download?fileId=' + data.data.fileId + '">' + dealFileName + '<span class="deleteAttach glyphicon glyphicon-remove"></span></a>'
            $(".attachFileBox").append(str)
            layer.msg('上传成功', { time: 1000, icon: 1 });
            $("[data-toggle='tooltip']").tooltip()
        }

    }
    $(".chooseFileButton").text("选择附件")
    clearInput()
})

//清空input[type=file]
function clearInput() {
    var obj = document.getElementById("file");
    obj.outerHTML = obj.outerHTML;
}
//选择问题类别提示框
function selectTips(str) {
    layer.confirm(str, {
        title: "温馨提示",
        btn: ['确定'] //按钮
    });
}
